#ifndef BASEOBJECT_H
#define BASEOBJECT_H

#include <string>
using namespace std;

#include "../Renderer/D3D11Renderer.h"
#include "../Utility/TextureManager.h"

class BaseObject
{
public:
	BaseObject()
	{
		texturesUsedFlag = 0;
		diffuseTextureID = -1;
		normalTextureID = -1;
		specularTextureID = -1;
	}

	BaseObject(const BaseObject& _baseObject){};
	~BaseObject(){};

	void virtual Initialize(string _name) = 0;
	void virtual Render() = 0;
	void virtual Update(float _dt) = 0;

	void AddTexture(TEXTURE_TYPE _textureType, WCHAR* _filename)
	{
		switch(_textureType)
		{
		case DIFFUSE_TEXTURE:
			diffuseTextureID = TextureManager::AddTexture(_filename);
			texturesUsedFlag |= (1 << DIFFUSE_TEXTURE);
			break;
		case NORMAL_TEXTURE:
			normalTextureID = TextureManager::AddTexture(_filename);
			texturesUsedFlag |= (1 << NORMAL_TEXTURE);
			break;
		case SPECULAR_TEXTURE:
			specularTextureID = TextureManager::AddTexture(_filename);
			texturesUsedFlag |= (1 << SPECULAR_TEXTURE);
			break;
		default:
			break;
		}
	}

	char GetTexuresUsedFlag(){return texturesUsedFlag;}
	string GetName(){return name;}
	int GetObjectID(){return objectID;}
	int GetDiffuseTextureID(){return diffuseTextureID;}
	int GetNormalTextureID(){return normalTextureID;}
	int GetSpecularTextureID(){return specularTextureID;}
	XMFLOAT3 GetPosition(){return position;}
	RECT GetImageSourceRect(){return imageSourceRect;}
	RECT GetCollisionRect(){return collisionRect;}

	void SetName(string _name){name = _name;}
	void SetObjectID(int _objectID){objectID = _objectID;}
	void SetPosition(XMFLOAT3 _position){position = _position;}
	void SetImageSourceRect(RECT _imageSourceRect){imageSourceRect = _imageSourceRect;}
	void SetCollisionRect(RECT _collisionRect){collisionRect = _collisionRect;}

private:
	char texturesUsedFlag;

	string name;
	int objectID;

	int diffuseTextureID;
	int normalTextureID;
	int specularTextureID;

	XMFLOAT3 position;

	RECT imageSourceRect;
	RECT collisionRect;
};

#endif // !BASEOBJECT_H
